package com.sise.wangzhan.controller;

import com.sise.wangzhan.entity.Person;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * @Classname PersonController
 * @Description TODO
 * @Date 2020/4/16 11:36
 * @Created by wangzhan
 */
@RestController
public class PersonController {

    @RequestMapping(value = "/person/{p_id}", method = RequestMethod.GET)
    public Person findPerson(@PathVariable("p_id") Integer p_id, HttpServletRequest request){

        Person person = new Person(p_id,"wangzhan",22);
        person.setMessage(request.getRequestURL().toString());

        return person;
    }

    @RequestMapping(value = "/hello",method = RequestMethod.GET)
    @ResponseBody
    public String hello(){
        return "hello world";
    }



}
